/**
 * Selling Partner API for Listings Items
 * The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API.  For more information, see the [Listings Items API Use Case Guide](https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2021-08-01-use-case-guide).
 *
 * The version of the OpenAPI document: 2021-08-01
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */

import { ApiClient } from '../ApiClient.js'
import { Item } from './Item.js'
import { Pagination } from './Pagination.js'

/**
 * The ItemSearchResults model module.
 * @module listingsitems_v2021_08_01/model/ItemSearchResults
 * @version 2021-08-01
 */
export class ItemSearchResults {
  /**
   * Constructs a new <code>ItemSearchResults</code>.
   * Selling partner listings items and search related metadata.
   * @alias module:listingsitems_v2021_08_01/model/ItemSearchResults
   * @class
   * @param numberOfResults {Number} The total number of selling partner listings items found for the search criteria (only results up to the page count limit is returned per request regardless of the number found).  Note: The maximum number of items (SKUs) that can be returned and paged through is 1000.
   * @param items {[Item]} A list of listings items.
   */
  constructor (numberOfResults, items) {
    this.numberOfResults = numberOfResults
    this.items = items
  }

  /**
   * Constructs a <code>ItemSearchResults</code> from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {ItemSearchResults} obj Optional instance to populate.
   * @return {ItemSearchResults} The populated <code>ItemSearchResults</code> instance.
   */
  static constructFromObject (data, obj) {
    if (data) {
      switch (typeof data) {
        case 'string':
          obj = String(data)
          break
        case 'number':
          obj = Number(data)
          break
        case 'boolean':
          obj = Boolean(data)
          break
      }
      obj = obj || new ItemSearchResults()
      if (data.hasOwnProperty('numberOfResults')) { obj.numberOfResults = ApiClient.convertToType(data.numberOfResults, 'Number') }
      if (data.hasOwnProperty('pagination')) { obj.pagination = Pagination.constructFromObject(data.pagination) }
      if (data.hasOwnProperty('items')) { obj.items = ApiClient.convertToType(data.items, [Item]) }
    }
    return obj
  }
}

/**
 * The total number of selling partner listings items found for the search criteria (only results up to the page count limit is returned per request regardless of the number found).  Note: The maximum number of items (SKUs) that can be returned and paged through is 1000.
 * @member {Number} numberOfResults
 * @type {Number}
 */
ItemSearchResults.prototype.numberOfResults = undefined

/**
 * @member {Pagination} pagination
 * @type {Pagination}
 */
ItemSearchResults.prototype.pagination = undefined

/**
 * A list of listings items.
 * @member {[Item]} items
 * @type {[Item]}
 */
ItemSearchResults.prototype.items = undefined
